import 'package:ysy_flutter_mvvm_yuanxuan/bean/base/BaseBean.dart';

class MineBean extends BaseJsonBean{
  int? memberId;
  String? memberUUID;
  String? nickName;
  String? username;
  String? icon;
  String? informationPercent;
  int? productCollect;
  int? storeCollect;
  int? favoriteContent;
  int? browsingRecords;
  int? userType;
  List<OrderCategoryCounts>? orderCategoryCounts;
  int? cartQuantity;

  MineBean(
      {this.memberId,
      this.memberUUID,
      this.nickName,
      this.username,
      this.icon,
      this.informationPercent,
      this.productCollect,
      this.storeCollect,
      this.favoriteContent,
      this.browsingRecords,
      this.userType,
      this.orderCategoryCounts,
      this.cartQuantity});

  MineBean.fromJson(Map<String, dynamic> json) {
    memberId = json['memberId'];
    memberUUID = json['memberUUID'];
    nickName = json['nickName'];
    username = json['username'];
    icon = json['icon'];
    informationPercent = json['informationPercent'];
    productCollect = json['productCollect'];
    storeCollect = json['storeCollect'];
    favoriteContent = json['favoriteContent'];
    browsingRecords = json['browsingRecords'];
    userType = json['userType'];
    if (json['orderCategoryCounts'] != null) {
      orderCategoryCounts = [];
      json['orderCategoryCounts'].forEach((v) {
        orderCategoryCounts?.add(new OrderCategoryCounts.fromJson(v));
      });
    }
    cartQuantity = json['cartQuantity'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['memberId'] = this.memberId;
    data['memberUUID'] = this.memberUUID;
    data['nickName'] = this.nickName;
    data['username'] = this.username;
    data['icon'] = this.icon;
    data['informationPercent'] = this.informationPercent;
    data['productCollect'] = this.productCollect;
    data['storeCollect'] = this.storeCollect;
    data['favoriteContent'] = this.favoriteContent;
    data['browsingRecords'] = this.browsingRecords;
    data['userType'] = this.userType;
    if (this.orderCategoryCounts != null) {
      data['orderCategoryCounts'] =
          this.orderCategoryCounts?.map((v) => v.toJson()).toList();
    }
    data['cartQuantity'] = this.cartQuantity;
    return data;
  }
}

class OrderCategoryCounts {
  int? type;
  int? count;

  OrderCategoryCounts({this.type, this.count});

  OrderCategoryCounts.fromJson(Map<String, dynamic> json) {
    type = json['type'];
    count = json['count'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['type'] = this.type;
    data['count'] = this.count;
    return data;
  }
}
